package com.qut.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.qut.service.controller_list_Service;

/**
 * Servlet implementation class controller_change_Servlet
 */
@WebServlet("/controller_change_Servlet")
public class controller_change_Servlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public controller_change_Servlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	
		String item_id=request.getParameter("item_id");
		String flyman_id=request.getParameter("flyman_id");
		String item_status=request.getParameter("item_status");
		
		controller_list_Service  controller_change_Service=new controller_list_Service();
	  
		boolean flag=controller_change_Service.change(item_id, flyman_id, item_status);
		boolean flag1=controller_change_Service.change0(item_id, flyman_id);
		PrintWriter out=response.getWriter();
		
		if(flag&&flag1) {
			
			out.write("1");
			}else {
			out.write("0");
			}
			out.close();
	
	}

}
